//
//  GCBackgroundLayer.m
//  GalaxyConqueror
//
//  Created by Test on 8/3/14.
//  Copyright (c) 2014 Stefan.Nestorov. All rights reserved.
//

#import "GCBackgroundLayer.h"

@implementation GCBackgroundLayer

-(instancetype)init
{
    
    self = [super init];
    if ( self ) {
        SKTextureAtlas *backgroundAtlas = [GCGlobals textureAtlasNamed:@"background"];
        
        SKSpriteNode * background = [SKSpriteNode spriteNodeWithTexture:[backgroundAtlas textureNamed:@"background"]];
        [background setAnchorPoint:CGPointZero];
        
        SKSpriteNode * background2 = [SKSpriteNode spriteNodeWithTexture:[backgroundAtlas textureNamed:@"background"]];
        [background2 setAnchorPoint:CGPointZero];
        [background2 setPosition:CGPointMake(background.frame.size.width, 0)];
        
        [self addChild:background];
        [self addChild:background2];
        
    }
    
    return self;
    
}

-(void)update:(CFTimeInterval)dt
{
    
    [self setPosition:CGPointMake(self.position.x - 10 * dt, self.position.y)];
    
    
}

@end
